#include "potiondata.h"
#include "buffs.h"
#include "symbol.h"
#include "creature.h"
#include "message.h"

bool Potion::ItemType( uint* type ) const
{
    *type |= WIELDABLE_1H;
    return true;
}

bool Potion::ItemCategory( uint* category ) const
{
    *category = CONSUMABLE;
    return true;
}

bool Potion::ItemWeight( uint* weight ) const
{
    *weight += 12;
    return true;
}

bool Potion::OnEaten( Creature* c )
{
    Bank().Manipulation( MANIPULATION_DRINK_OTHER, c, this );
    Destroy();
    return true;
}

bool Potion::ItemSymbol( IO::Sym* symbol ) const
{
    symbol->first = '!';
    return true;
}

bool HealingPotion::Name( std::string* name, bool* plural, uint article ) const
{
    if ( name->empty() && article == ARTICLE_INDEFINITE )
        *name += "a ";
    if ( article == ARTICLE_PLURAL )
        *name += "potions of healing";
    else
        *name += "potion of healing";
    return true;
}

bool HealingPotion::OnEaten( Creature* c )
{
    Buff* b = new DerivedStatsBuff( 0.1, 0.0, 0 );
    b->SetTarget( c );
    b->StartTimer( 300 );
    Potion::OnEaten( c );
    return true;
}

bool HealingPotion::ItemSymbol( IO::Sym* symbol ) const
{
    Potion::ItemSymbol( symbol );
    symbol->second = Colour( 255, 64, 64 );
    return true;
}

bool ManaPotion::Name( std::string* name, bool* plural, uint article ) const
{
    if ( name->empty() && article == ARTICLE_INDEFINITE )
        *name += "a ";
    if ( article == ARTICLE_PLURAL )
        *name += "potions of energy";
    else
        *name += "potion of energy";
    return true;
}

bool ManaPotion::OnEaten( Creature* c )
{
    Buff* b = new DerivedStatsBuff( 0.0, 0.1, 0 );
    b->SetTarget( c );
    b->StartTimer( 300 );
    Potion::OnEaten( c );
    return true;
}

bool ManaPotion::ItemSymbol( IO::Sym* symbol ) const
{
    Potion::ItemSymbol( symbol );
    symbol->second = Colour( 64, 64, 255 );
    return true;
}